#!/usr/bin/env python

import BugleChecks

def internal_checks(env):
    '''
    Checks that will only affect C files in the platform directory.
    '''

    if env.GetOption('help') or env.GetOption('clean'):
        return env

    conf = Configure(env, custom_tests = BugleChecks.tests, config_h = 'platform_config.h')
    return conf.Finish()

Import('envs', 'srcdir', 'targets')

envs['host'].Append(CPPPATH = [srcdir, Dir('.')],
    LIBS = ['user32', 'kernel32', 'ws2_32'])

platform_env = internal_checks(envs['host'].Clone())

targets['bugleutils']['source'].extend(platform_env.SharedObject(source = [
    '../cosf_pass.c',
    '../gettime_queryperformancecounter.c',
    '../io_msvcrt.c',
    '../isfinite_msvcrt.c',
    '../isnan_msvcrt.c',
    '../nan_soft.c',
    '../process_null.c',
    '../round_soft.c',
    '../sinf_pass.c',
    '../strdup_msvcrt.c',
    '../strndup_soft.c',
    '../threads_msvcrt.c',
    '../vasprintf_msvcrt.c',
    '../vsnprintf_msvcrt.c']))

targets['bugle']['source'].extend(platform_env.SharedObject(source = [
    '../dl_loadlibrary.c'
    ]))
